package com.ruoyi.web.controller;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @创建人：xiaobao
 * @创建时间： 2020/10/18.
 * @描述：
 */
public class Test {
    public static void main(String[] args) {
        Boolean isMatch = Pattern.matches("(\\D*)(\\d+)(.*)","This order was placed for QT3000! OK?");
        System.out.println(isMatch);

        // 按指定模式在字符串查找
        String line = "This order was placed for QT3000! OK?";
        String pattern = "\\d+";

        // 创建 Pattern 对象
        Pattern r = Pattern.compile(pattern);

        // 现在创建 matcher 对象
        Matcher m = r.matcher(line);
        if (m.find( )) {
            System.out.println("Found value: " + m.group(0) );
        } else {
            System.out.println("NO MATCH");
        }
    }
}
